#!/bin/sh
if [ "${POSTUREPATH}" == "" ]; then
  echo "缺少POSTUREPATH配置 (You missed the configuration of POSTUREPATH)"
  exit 1
fi
. $POSTUREPATH/include/function.sh

printLogo
echo "温馨提示: 请务必在提交代码前确认分支是否正确 (Warm tips: please make sure the branch is correct before committing)"

BRANCH_NAME=$(git symbolic-ref --short -q HEAD)
if [ "${BRANCH_NAME}" == "main" ] || [ "${BRANCH_NAME}" == "master" ]; then
  echo "禁止直接再主分支提交代码, 已终止! (You are not allowed to commit at main branch, has been stopped !)"
  exit 1
fi
echo "> 提交本地 (your commit branch): \033[33m${BRANCH_NAME}\033[0m"

# 移除消息内容中的空格 sed s/[[:space:]]//g
ORIGIN_COMMIT=$(cat $1 | sed s/[[:space:]]//g)
echo "> 提交信息 (your commit msg): \033[33m${ORIGIN_COMMIT}\033[0m"

loading
